package 网络编程;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class TestMethod {
    public static void main(String[] args) {
        try {
            Class clazz = Account.class;
            Properties prop = new Properties();
            FileReader fr = new FileReader("src//网络编程//config.properties");
            prop.load(fr);
            String tomethod = prop.getProperty("tomethod");
            Method method = clazz.getMethod(tomethod,Double.class);
            System.out.println(tomethod);
            Account account = (Account) clazz.newInstance();

            System.out.println(account.getBalance());
            method.invoke(account,new Double(2000.0));
            System.out.println(account.getBalance());
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}